package tg.app.rj.workticket;

import java.rmi.RemoteException;
import java.util.HashSet;

import psdi.mbo.Mbo;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSet;
import psdi.mbo.MboValueInfo;
import psdi.util.MXException;

/***
 * 
 * @author Administrator
 *
 */
public class WorkOrderZbMbo extends Mbo implements WorkOrderZbMboRemote {
	
	private static HashSet skipFieldCopy = new HashSet();
	private static boolean isHashSetLoaded = false;
	
	public WorkOrderZbMbo(MboSet ms) throws RemoteException {
		super(ms);
	}
	
	protected boolean skipCopyField(MboValueInfo mbovalueinfo) throws RemoteException, MXException {
		if(!isHashSetLoaded){
			loadSkipFieldCopyHashSet();
		}
		return skipFieldCopy.contains(mbovalueinfo.getName());
	}
	
	@Override
	public void add() throws MXException, RemoteException {
		super.add();
		MboRemote parent = this.getOwner();
		if(parent!=null){
			setValue("ORGID",parent.getString("ORGID"),11L);
			setValue("SITEID",parent.getString("SITEID"),11L);
			setValue("WTNUM",parent.getString("WTNUM"),11L);
		}
	}

	private static void loadSkipFieldCopyHashSet() throws MXException, RemoteException {
		isHashSetLoaded = true;
		skipFieldCopy.add("ORGID");
		skipFieldCopy.add("SITEID");
		skipFieldCopy.add("WTNUM");
		skipFieldCopy.add("WORKORDERZBID");
	}

}
